﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace SachOnlineLibrary.Public
{
    public class Sach
    {
        private int maSach;
        public int MaSach
        {
            get { return maSach; }
            set { maSach = value; }
        }
        private int maLoai;
        public int MaLoai
        {
            get { return maLoai; }
            set { maLoai = value; }
        }
        private string nhaXuatBan;
        public string NhaXuatBan
        {
            get { return nhaXuatBan; }
            set { nhaXuatBan = value; }
        }
        private string tenSach;
        public string TenSach
        {
            get { return tenSach; }
            set { tenSach = value; }
        }
        private string mota;
        public string Mota
        {
            get { return mota; }
            set { mota = value; }
        }
        private long giaTien;
        public long GiaTien
        {
            get { return giaTien; }
            set { giaTien = value; }
        }
        private int soLuong;
        public int SoLuong
        {
            get { return soLuong; }
            set { soLuong = value; }
        }
        private string tacGia;
        public string TacGia
        {
            get { return tacGia; }
            set { tacGia = value; }
        }
        private bool trangThai;

        public bool TrangThai
        {
            get { return trangThai; }
            set { trangThai = value; }
        }
        private string hinh;

        public string Hinh
        {
            get { return hinh; }
            set { hinh = value; }
        }
        private DateTime ngayCapNhat;
        public DateTime NgayCapNhat
        {
            get { return ngayCapNhat; }
            set { ngayCapNhat = value; }
        }
        private Loai loai=new Loai();

        public Loai Loai
        {
            get { return loai; }
            set { loai = value; }
        }
        public void ChuyenDoi (DataRow dr)
        {
            MaSach = int.Parse(dr[0].ToString());
            MaLoai = int.Parse(dr[1].ToString());
            TenSach = dr[2].ToString();
            Mota = dr[3].ToString();
            GiaTien = long.Parse(dr[4].ToString());
            SoLuong = int.Parse(dr[5].ToString());
            TacGia = dr[6].ToString();
            NhaXuatBan = dr[7].ToString();
            NgayCapNhat = DateTime.Parse(dr[8].ToString());
            Hinh = dr[9].ToString();
            TrangThai = bool.Parse(dr[10].ToString());
        }
    }
}
